package com.soft.springhrms.controller;
import com.soft.springhrms.pojo.Employees;
import com.soft.springhrms.service.EmployeesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;

@CrossOrigin
@RestController
@RequestMapping("/employees")
public class GetEmployeeController {
    @Autowired
    private EmployeesService employeeService;

    @GetMapping("/countByDepartment/{departmentId}")
    public int countByDepartment(@PathVariable Integer departmentId) {
        return employeeService.countByDepartment(departmentId);
    }

    @GetMapping("/countByPosition/{positionId}")
    public int countByPosition(@PathVariable Integer positionId) {
        return employeeService.countByPosition(positionId);
    }

    @GetMapping
    public List<Employees> getAllEmployees() {
        return employeeService.list();
    }
}
